package org.sockettest.client;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

public class Test {
    public static void main(String[] args) throws IOException {
        Socket connection = new Socket("127.0.0.1", 11111);
        System.out.println("连接成功");

        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        PrintWriter out = new PrintWriter(connection.getOutputStream());

        while (true){
            String str = in.readLine();
            out.println(str);
            out.flush();
            if("bye".equals(str)){
                break;
            }
        }
    }
}
